package com.atguigu.gulimall.order;

import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;

/***
 * 使用RabbitMQ
 * 1.引入amqp场景启动器依赖 RabbitAutoConfiguration自动生效
 * 2.给容器自动配置了
 *      RabbitTemplate(发送与接收消息)、AmqpAdmin(管理组件，创建队列、交换机与绑定关系)、
 *      CachingConnectionFactory(连接工厂)、 RabbitMessagingTemplate(消息组件);
 *      所有的属性都是spring. rabbitmq
 *      @ConfigurationProperties(prefix = "spring.rabbitmq")
 *
 * 3.给配置文件中配置MQ信息  spring.rabbitmq.xxxxx
 * 4、开启
 *      @EnableRabbit: @EnableXxxxx
 * 5.监听消息：使用 @RabbitListener与@RabbitHandler
 *      @RabbitListener:类+方法上（监听哪些队列）
 *      @RabbitHandler:方法上（重载区分不同的消息）
 */

@EnableRabbit
@EnableFeignClients
@EnableDiscoveryClient
@SpringBootApplication
public class GulimallOrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(GulimallOrderApplication.class, args);
    }

}
